package com.hilihili.controller.uploadController;

import com.hilihili.domain.entity.District;
import com.hilihili.domain.entity.Tag;
import com.hilihili.domain.entity.Topic;
import com.hilihili.service.IDistrictService;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("hilihili/district")
public class DistrictController {

    @Autowired
    IDistrictService districtService;

    @GetMapping("/getDistrict")
    public AjaxResult getDistrict() {
        List<District> districts = districtService.getDistrict();
        return AjaxResult.success(districts);
    }

    @GetMapping("/getDistrictItem")
    public AjaxResult getDistrictItem(Integer parentId) {
        List<District> districts = districtService.getDistrictItem(parentId);
        return AjaxResult.success(districts);
    }

    @GetMapping("/getTag")
    public AjaxResult getTag(String tag) {
        List<Tag> districts = districtService.getTag(tag);
        return AjaxResult.success(districts);
    }
    @GetMapping("/getTopic")
    public AjaxResult getTopic(String tag) {
        List<Topic> districts = districtService.getTopic(tag);
        return AjaxResult.success(districts);
    }
}
